home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / xfs / linux.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-10-04  |  2.9 KB  |  123 lines

  1. /*
  2.  * Copyright (c) 2004-2005 Silicon Graphics, Inc.  All Rights Reserved.
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public License
  6.  * as published by the Free Software Foundation.
  7.  *
  8.  * This program is distributed in the hope that it would be useful,
  9.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  * GNU Lesser General Public License for more details.
  12.  *
  13.  * You should have received a copy of the GNU Lesser General Public License
  14.  * along with this program; if not, write the Free Software Foundation,
  15.  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  16.  */
  17. #ifndef __XFS_LINUX_H__
  18. #define __XFS_LINUX_H__
  19.  
  20. #include <uuid/uuid.h>
  21. #include <sys/vfs.h>
  22. #include <sys/ioctl.h>
  23. #include <sys/param.h>
  24. #include <sys/sysmacros.h>
  25. #include <malloc.h>
  26. #include <getopt.h>
  27. #include <endian.h>
  28. #include <xfs/swab.h>
  29.  
  30. static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
  31. {
  32.     return ioctl(fd, cmd, p);
  33. }
  34.  
  35. static __inline__ int platform_test_xfs_fd(int fd)
  36. {
  37.     struct statfs buf;
  38.     if (fstatfs(fd, &buf) < 0)
  39.         return 0;
  40.     return (buf.f_type == 0x58465342);    /* XFSB */
  41. }
  42.  
  43. static __inline__ int platform_test_xfs_path(const char *path)
  44. {
  45.     struct statfs buf;
  46.     if (statfs(path, &buf) < 0)
  47.         return 0;
  48.     return (buf.f_type == 0x58465342);    /* XFSB */
  49. }
  50.  
  51. static __inline__ int platform_fstatfs(int fd, struct statfs *buf)
  52. {
  53.     return fstatfs(fd, buf);
  54. }
  55.  
  56. static __inline__ void platform_getoptreset(void)
  57. {
  58.     extern int optind;
  59.     optind = 0;
  60. }
  61.  
  62. static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
  63. {
  64.     return uuid_compare(*uu1, *uu2);
  65. }
  66.  
  67. static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
  68. {
  69.     uuid_unparse(*uu, buffer);
  70. }
  71.  
  72. static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
  73. {
  74.     return uuid_parse(buffer, *uu);
  75. }
  76.  
  77. static __inline__ int platform_uuid_is_null(uuid_t *uu)
  78. {
  79.     return uuid_is_null(*uu);
  80. }
  81.  
  82. static __inline__ void platform_uuid_generate(uuid_t *uu)
  83. {
  84.     uuid_generate(*uu);
  85. }
  86.  
  87. static __inline__ void platform_uuid_clear(uuid_t *uu)
  88. {
  89.     uuid_clear(*uu);
  90. }
  91.  
  92. static __inline__ void platform_uuid_copy(uuid_t *dst, uuid_t *src)
  93. {
  94.     uuid_copy(*dst, *src);
  95. }
  96.  
  97. #if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ <= 1))
  98. # define constpp    const char * const *
  99. #else
  100. # define constpp    char * const *
  101. #endif
  102.  
  103. #define ENOATTR        ENODATA    /* Attribute not found */
  104. #define EFSCORRUPTED    EUCLEAN    /* Filesystem is corrupted */
  105.  
  106. typedef loff_t        xfs_off_t;
  107. typedef __uint64_t    xfs_ino_t;
  108. typedef __uint32_t    xfs_dev_t;
  109. typedef __int64_t    xfs_daddr_t;
  110. typedef char*        xfs_caddr_t;
  111.  
  112. #ifndef    _UCHAR_T_DEFINED
  113. typedef unsigned char    uchar_t;
  114. #define    _UCHAR_T_DEFINED    1
  115. #endif
  116.  
  117. #ifndef _BOOLEAN_T_DEFINED
  118. typedef enum {B_FALSE, B_TRUE}    boolean_t;
  119. #define _BOOLEAN_T_DEFINED    1
  120. #endif
  121.  
  122. #endif    /* __XFS_LINUX_H__ */
  123.